package io.读数据并打印;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

public class demo6 {
    public static void main(String[] args) throws IOException {
       InputStream inputStream=new FileInputStream("D:\\test.txt");
            byte[] buffer=new byte[1024];
            int n=inputStream.read(buffer);
            System.out.println("n="+n);
            for (int i = 0; i < n; i++) {
                System.out.printf("%x\n",buffer[i]);//以16进制进行打印
                //1个字节--8个比特位--2个16进制数字
            }
    }
}




















